package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {
	c5 := make(chan int, 0)

	go func() {
		defer close(c5)
		for i := 0; i < 5; i++ {
			time.Sleep(1 * time.Second)
			c5 <- rand.Intn(20)
		}
	}()
	// time.Sleep(5 * time.Second)
	for v := range c5 {
		fmt.Println("for iterate", v)
	}
	fmt.Println("main over")
}
